<%@page import="guest.GuestVo"%>
<%@page import="java.util.Vector"%>
<%@page import="guest.Guest"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style>
#viewmain{
	margin:auto;
	width:700px;
}
#book_subject1,#book_subject2{
	display:inline-block;
}
#book_subject{
	width:430px;
	display:inline-block;
	border:2px solid #aaaaaa;
}
#book_mdate{
	width:255px;
	display:inline-block;
	border:2px solid #aaaaaa;
}
#book_content{
	width:695px;
	height:400px;
	border:2px solid #aaaaaa;
	
}
#book_subject3-1,#book_subject3-2,#book_subject3-3,#book_subject3-4,#book_btn{
	display:inline-block;
}
#book_btn{
	float:right;
}

</style>

<script>
function getId(id){ return document.getElementById(id) }
function init(){
	getId('btnlist').onclick=function(){
		location.href='MyHome.jsp?inc_content=./guest/list.jsp';
	}
/* 	getId('btnmodify').onclick=function(){
		var serial = getId('serial').value;
		location.href='index2.jsp?inc_content=./guest/modify_result.jsp&serial='+serial;
	}
	getId('btndelete').onclick=function(){
		var serial = getId('serial').value;
		location.href='index2.jsp?inc_content=./guest/delete_result.jsp&serial='+serial;
	} */
}

function modify(serial){
	var f = confirm("정말 수정하시겠습니까?");
	if(f){
		frm.action = 'MyHome.jsp?inc_content=./guest/modify_result.jsp';
		frm.submit();
		/* location.href='index2.jsp?inc_content=./guest/modify_result.jsp&serial=serial'; */
	}else{
		alert("취소되었습니다");
	}
	
}
function del(serial){
	var f = confirm("정말 삭제하시겠습니까?");
	if(f){
		location.href='MyHome.jsp?inc_content=./guest/delete_result.jsp&serial='+serial;
	}else{
		alert("취소되었습니다");
	}
}

</script>

</head>
<body>
<jsp:useBean id="vo" class="guest.GuestVo" scope="page"/>
<jsp:setProperty property="*" name="vo"/> <!-- all setter  -->
<%
Guest g = new Guest();
g.setVo(vo);
GuestVo gv = g.view();
if(gv==null){
	out.print("<li>관련 글이 삭제되었거나 없습니다.");
}
%>

<form id='viewmain' name='frm' method='post' action='MyHome.jsp?inc_content=./guest/modify_result.jsp' >
<%-- <label>게시번호</label>
<label id='serial'><%=gv.getSerial()%></label>	<br/> --%>
<div id='book_subject1'>
	<label>제목</label>
</div>
<div id='book_subject2'>
	<input type='text' name='subject' value='<%=gv.getSubject()%>'>
	
</div>


<div id='book_content'><textarea rows="26" cols="96" name='content'><%=gv.getContent()%></textarea></div>


<div id='book_bot'>
<div id='book_subject3'>
	<div id='book_subject3-1'>아이디</div>
	<div id='book_subject3-2'><input type='text' name='mid' value="<%=gv.getMid()%>"></div>
	<div id='book_subject3-3'>비밀번호</div>
	<div id='book_subject3-4'><input type='text'></div>
	<div id='book_btn'>
		<input type='button' id ='btnlist'  value='목록'>
		<input type='submit' id ='btnmodify' value='수정'>
		<input type='button' id ='btndelete' value='삭제' onclick='del(<%=gv.getSerial()%>)')>
	</div>
</div>
		<input type='hidden' id='serial' name='serial' value="<%=gv.getSerial()%>">
</div>
</form>
<script>init();</script>
</body>
</html>